#ifndef PROFILETABLEMODEL_H
#define PROFILETABLEMODEL_H

#include <QList>
#include <QAbstractTableModel>
#include <QStyleOptionViewItem>
#include <QTableView>
#include "userprofile.h"

#define GetListAtRowRole        Qt::UserRole+1
#define GetFileNameRole         Qt::UserRole+2
#define SaveToFileRole          Qt::UserRole+3
#define LoadFromRole            Qt::UserRole+4
#define GetListSizeRole         Qt::UserRole+5
#define GetListProviders        Qt::UserRole+6
#define SetFilenameRole         Qt::UserRole+7
#define SetProgressBarRole      Qt::UserRole+8
#define GetProgressBarRole      Qt::UserRole+9
#define GetStatusStringRole     Qt::UserRole+10
#define GetStatusTypeRole       Qt::UserRole+11
#define SetStatusStringRole     Qt::UserRole+12
#define SetStatusTypeRole       Qt::UserRole+13
#define GetLoginTypesRole       Qt::UserRole+14

#define GetListAtRowRoleTrick   Qt::UserRole+0x100
#define GetRowTrick(x)          GetListAtRowRoleTrick+x

class ProfileTableModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    explicit ProfileTableModel(QAbstractTableModel *parent = 0);
    ~ProfileTableModel();
    QList<UserProfile *>    list;
    QStringList             availableProviders;
    QStringList             loginTypes;
    QStringList             header_data;

    QVariant    data        (const QModelIndex &index, int role) const;
    bool        setData     (const QModelIndex &index, const QVariant &value, int role);

    int         rowCount(const QModelIndex &parent=QModelIndex()) const;
    int         columnCount(const QModelIndex &parent) const;

    QVariant    headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const;
    Qt::ItemFlags   flags(const QModelIndex &index) const;
signals:
    void        createNewRow(int row);
    void        removedRow(int row);
    void        zeroRows();
public slots:
    void        addRow();
    bool        removeRows(QObject *view);
private:
    QList<int>  progress_percents;
    QStringList status_strings;
    QList<bool> status_type;
};

#endif // PROFILETABLEMODEL_H
